import axios from '@/utils/axios';

// 获取药品列表
export const medicineList = (data) => {
    return axios({
        url: '/medicine/list',
        method: 'post',
        data
    })
};

// 获取药品详情
export const getMedicineDetail = (id) => {
    return axios({
        url: `/medicine/detail/${id}`,
        method: 'get'
    })
};

// 创建药品
export const createMedicine = (data) => {
    return axios({
        url: '/medicine/add',
        method: 'post',
        data
    })
};

// 更新药品信息
export const updateMedicine = (data) => {
    return axios({
        url: '/medicine/update',
        method: 'put',
        data
    })
};

// 删除药品
export const deleteMedicine = (id) => {
    return axios({
        url: `/medicine/delete/${id}`,
        method: 'delete'
    })
};

// 获取选项信息
export const getDrugOptions = () => {
    return axios({
        url: '/medicine/options',
        method: 'get',
    })
};

// 查询药品
export const searchMedicine = (params) => {
    return axios({
        url: '/medicine/shop/search',
        method: 'get',
        params
    })
};

export const searchMedicineById = (id) => {
    return axios({
        url: `/medicine/detail/${id}`,
        method: 'get'
    })
};